import request from '@/utils/request'

export const findAllCategory = () => {
  return request('/home/category/head', 'get')
}

/**
 * 顶级类目信息
 * @param {String} id - 顶级类目ID
 * @returns Promise
 */
export const findTopCategory = (id) => {
  return request('/category', 'get', { id })
}

/**
 * 获取二级类目筛选条件数据
 * @param {String} id - 二级类目ID
 * @returns Promise
 */
export const findSubCategoryFilter = (id) => {
  return request('/category/sub/filter', 'get', { id })
}

/**
 * 获取分类下的商品（带筛选条件）
 * @param {Object} params - 商品列表请求参数
 * @returns Promise
 */
export const findSubCategoryGoods = (params) => {
  return request('/category/goods/temporary', 'post', params)
}
